package com.example.computer_exam_training_sys.mapper;

import com.example.computer_exam_training_sys.vo.WrongQuestionWithDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface WrongQuestionDetailMapper {
    @Select("SELECT uwq.*, q.content, q.answer, q.analysis, q.question_type, q.difficulty \n" +
            "FROM user_wrong_questions uwq \n" +
            "LEFT JOIN questions q ON uwq.question_id = q.question_id\n " +
            "WHERE uwq.user_id = #{userId} \n" +
            "AND uwq.is_deleted = 0\n " +
            "ORDER BY uwq.last_wrong_time DESC")
    List<WrongQuestionWithDetail> ByUserId(Integer userId);
}
